package training.io;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.apache.commons.io.IOUtils;

public class BacaFileDemo {
	public static void main(String[] args) throws Exception {
		File file = new File("quotes.txt");
		
		InputStream in = new FileInputStream(file);
		
		InputStreamReader reader = new InputStreamReader(in);
		
		int data;
		while((data = reader.read()) != -1){
			// datanya berupa ascii byte, 
			// jadi harus dikonversi
			System.out.print((char)data);
		}
		
		// setelah pakai, jangan lupa dibereskan
		reader.close();
		in.close();
	}
}
